
<!-- Xu ly Click chon tu --> 
<script type="text/javascript" language="javascript">
    
    function CreateXMLHttpRequest()
    {
        if ( window.XMLHttpRequest )
        {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            return new XMLHttpRequest()
        }
        else if (window.ActiveXObject )
        {
            // code for IE6, IE5
            return new ActiveXObject("Microsoft.XMLHTTP")
        }
    }
    
    
    function ClickTagFriend()
    {
        var xmlHttp;
        xmlHttp = CreateXMLHttpRequest();
        xmlHttp.onreadystatechange = function()
        {
            if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
            {
                var kq = xmlHttp.responseText;
			
                document.getElementById("tagFriend").innerHTML = kq;
            }
        }
        
        var serverURL =  'ClickTagFriend?t=' + (new Date()).getTime();
		
        xmlHttp.open("get", serverURL, true);
		
        xmlHttp.send(null);
    }
    </script>


<?php
   $subjectWriting=" ";
   $subjectWriting = $_SESSION["subjectWriting"] ;
   $idlesson = $_SESSION["idLesson"];
  
   
   $IDUserOnline = elgg_get_logged_in_user_guid();  // Dung cho viec tag friend
?>


<div class = "topic"> <!-- khung ghi đề bài -->
	<div class="left">
	<img src='<?php echo elgg_get_site_url(); ?>mod/MyCourse/Resources/Tool/writing/topic.jpg' width="50" height="50" alt="topic"/>
	<p>Đề Bài:</p>
    </div>
     
    <div class="right">
	<textarea style="min-height:25px;width:auto;max-width:770px;font-size:16px;" cols="60" rows="4" name="field_writing_user_answer[0][value]"><?php echo $subjectWriting; ?></textarea>
    </div>
    
    
</div> <!-- End khung ghi đề bài -->


<div id = "writingBox"> <!-- khung viết bài -->
	<img src='<?php echo elgg_get_site_url(); ?>mod/MyCourse/Resources/Tool/writing/writing2.jpg' width="50" height="50" alt="writing"/>
	Bài Viết:
    <?php 
    $myWriteContent = "";
    $valueOfSumitButton = "Post";
    if(isset($_SESSION['myWriteContent']))
    {
       $myWriteContent = $_SESSION['myWriteContent'];
       
       $valueOfSumitButton = "Edit Post";
    }
     echo elgg_view('input/plaintext', array(
	                    'name' => 'Content',
	                    'id' => 'f15',
                            'value'=>$myWriteContent,
	                    ));
	            ?>
    
    <input id="post" type="submit" name="post" value="<?php echo $valueOfSumitButton; ?>" class="elgg-button elgg-button-submit"/>
   
      <a  href="#" onclick='ClickTagFriend();' class="elgg-button elgg-button-submit" >Tag Friends </a>
        <div id="tagFriend">
        </div>
</div> <!-- End khung viết bài -->